<!DOCTYPE html>
<meta charset="UTF-8">
<style>
.container {
  margin-bottom: -4px;
}
.parent {
  rx: 30px;
}
.target {
  fill: black;
  rx: 10px;
}
.expected {
  fill: green;
}
</style>
<body>
<template id="target-template">
  <svg width="400" height="20">
    <rect x="0" y="0" width="400" height="20" ry="10" class="target"/>
  </svg>
</template>
<script src="resources/interpolation-test.js"></script>
<script>
assertInterpolation({
  property: 'rx',
  from: neutralKeyframe,
  to: '20px',
}, [
  {at: -0.3, is: '7px'},
  {at: 0, is: '10px'},
  {at: 0.3, is: '13px'},
  {at: 0.6, is: '16px'},
  {at: 1, is: '20px'},
  {at: 1.5, is: '25px'},
]);

assertNoInterpolation({
  property: 'rx',
  from: 'initial',
  to: '20px',
});

assertInterpolation({
  property: 'rx',
  from: 'inherit',
  to: '20px',
}, [
  {at: -0.3, is: '33px'},
  {at: 0, is: '30px'},
  {at: 0.3, is: '27px'},
  {at: 0.6, is: '24px'},
  {at: 1, is: '20px'},
  {at: 1.5, is: '15px'},
]);

assertNoInterpolation({
  property: 'rx',
  from: 'unset',
  to: '20px',
});

assertInterpolation({
  property: 'rx',
  from: '0px',
  to: '20px'
}, [
  {at: -0.3, is: '0px'}, // SVG rx can't be negative.
  {at: 0, is: '0px'},
  {at: 0.3, is: '6px'},
  {at: 0.6, is: '12px'},
  {at: 1, is: '20px'},
  {at: 1.5, is: '30px'},
]);
assertInterpolation({
  property: 'rx',
  from: '0px',
  to: '10em'
}, [
  {at: -0.3, is: '0em'}, // SVG rx can't be negative.
  {at: 0, is: '0em'},
  {at: 0.3, is: '3em'},
  {at: 0.6, is: '6em'},
  {at: 1, is: '10em'},
  {at: 1.5, is: '15em'},
]);
assertInterpolation({
  property: 'rx',
  from: '30px',
  to: '10em'
}, [
  {at: -0.3, is: '0px'},
  {at: 0, is: '30px'},
  {at: 0.3, is: '69px'},
  {at: 0.6, is: '108px'},
  {at: 1, is: '10em'},
  {at: 1.5, is: '225px'},
]);
assertInterpolation({
  property: 'rx',
  from: '10em',
  to: '0px'
}, [
  {at: -0.3, is: '13em'},
  {at: 0, is: '10em'},
  {at: 0.3, is: '7em'},
  {at: 0.6, is: '4em'},
  {at: 1, is: '0em'},
  {at: 1.5, is: '0em'}, // SVG rx can't be negative.
]);
assertInterpolation({
  property: 'rx',
  from: '10em',
  to: '30px'
}, [
  {at: -0.3, is: '199px'},
  {at: 0, is: '10em'},
  {at: 0.3, is: '121px'},
  {at: 0.6, is: '82px'},
  {at: 1, is: '30px'},
  {at: 1.5, is: '0px'},
]);
assertInterpolation({
  property: 'rx',
  from: '0',
  to: '20'
}, [
  {at: -0.3, is: '0'},
  {at: 0, is: '0'},
  {at: 0.3, is: '6'},
  {at: 0.6, is: '12'},
  {at: 1, is: '20'},
  {at: 1.5, is: '30'},
]);
</script>
</body>
